Chai code
===============

This folder contains (most of the) code developed for chai.

- re.c: Prototype sample to drive the GPU. Links with shim, synthesise,
  memory, etc.
- synthesise.c: Core of the prototype driver. Generates GPU memory data
  structures for job submission, uploading shaders, vertices, etc.
- shim.c: Interface with the [kernel](https://notabug.org/cafe/oolong).
  Primarily generates ioctls. If the kernel ABI changes, only shim.c
  changes.
- memory.c: Memory management stub. Allocates a chunk of memory through
  shim.c and implements a simple waterfall allocator. In the future, a
  proper allocator will be used instead.
- ktrace.c: GPU tracer. Optionally linked with the
  [kernel](https://notabug.org/cafe/oolong) to debug chai and trace
  the blob.
- chai-notes.h: Assortment of data structures, constants, and macros for
  interfacing with the GPU. Some parts were found in the kernel code
  dump. Others are the product of reverse-engineering. Some are a mix of
  the two.
- jobs.h: Data structure from kernelspace needed in userland.
- black-output-trace.c: Autogenerated file needed by ktrace. Run
  [black](https://notabug.org/cafe/black) to generate this.
